﻿using HuiZe.education.ViewModel;
using Paint;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace HuiZe.education.View.Toolbar
{
    /// <summary>
    /// InkCanvasTool.xaml 的交互逻辑
    /// </summary>
    public partial class InkCanvasTool : UserControl
    {
        public InkCanvasTool()
        {
            InitializeComponent();
            this.DataContext = new InkCanvasToolViewModel();
        }

        private void ButtonInstrument_Checked(object sender, RoutedEventArgs e)
        {
            var button = sender as ToggleButton;

            foreach (var key in BeginClass27.buttonToStrategy.Keys)
                key.IsChecked = button == key;
         
            BeginClass27.strategy = BeginClass27.buttonToStrategy[button];
        }

        private void ButtonFontSize_Checked(object sender, RoutedEventArgs e)
        {
            var button = sender as ToggleButton;
            if (radio_small == button)
            {
                radio_middle.IsChecked = false;
                radio_large.IsChecked = false;
                BeginClass27.settings.StrokeThickness = 1;
            }
            if (radio_middle == button)
            {
                radio_small.IsChecked = false;
                radio_large.IsChecked = false;
                BeginClass27.settings.StrokeThickness = 5;
            }
            if (radio_large == button)
            {
                radio_small.IsChecked = false;
                radio_middle.IsChecked = false;
                BeginClass27.settings.StrokeThickness = 9;
            }
        }

        private void ButtonInstrument_Unchecked(object sender, RoutedEventArgs e)
        {
            BeginClass27.strategy = null;
        }
    }
}
